﻿using Authentication.Configuration;
using Authentication.Model.Model;
using Common.Data.Extensions;
using System.Data.Entity.ModelConfiguration;

namespace Authentication.Data.DBConfig
{
    public class RuleConfiguration : DBConfig<ApplicationRule>
    {
        public RuleConfiguration()
            : base(SystemConfiguration.Schema, SystemConfiguration.NamingType, SystemConfiguration.TABLE_PREFIX)
        {
            HasKey(x => new { x.ApplicationKey, x.RuleId });
            Property(c => c.ApplicationKey).IsRequired().HasMaxLength(36);
            Property(c => c.RuleId).IsRequired();//.HasMaxLength(36);
            Property(c => c.RuleNameLocal).HasMaxLength(100);
            Property(c => c.RuleNameEnglish).HasMaxLength(100);
            Property(c => c.Description).HasMaxLength(255);
            Property(c => c.Active).HasMaxLength(1);
        }
    }
}
